Skip to content

fix(mobile): prewarm the selected sandbox image (port #3511)#3596

Merged
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/mobile-prewarm-selected-sandbox-image
Jul 21, 2026
Merged

fix(mobile): prewarm the selected sandbox image (port #3511)#3596
trunk-io[bot] merged 2 commits into
mainfrom
posthog-code/mobile-prewarm-selected-sandbox-image

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

Problem

Mobile prewarms cloud sandboxes, but the warm request dropped the sandbox
environment / custom base image, so a warmed sandbox could be built on a
different image than the task would actually run on — and then get reused
anyway. This ports desktop PR #3511 to mobile.

Why: keep the warm path correct so a reused sandbox always matches the
selected image, matching desktop behaviour.

Changes

  • warmTask() now optionally sends sandbox_environment_id / custom_image_id
    in the warm request body (only when set).
  • useWarmTask folds both ids into the debounce/dedupe key, so changing the
    selection triggers a re-warm, and forwards them to the warm call.
  • runTaskInCloud carries the ids on the run so a reused warm sandbox matches
    the selection instead of a mismatched default.

Mobile has no sandbox-environment / custom-image picker today (the ids are only
surfaced read-only via the custom-image badge), so these values are threaded as
optional seams — inert until a selection exists, no new picker UI added.

How did you test this?

  • Added unit tests (api.warm.test.ts, api.test.ts, useWarmTask.test.tsx)
    covering: ids forwarded when set, omitted when unset, and the warm key
    re-warming when the image selection changes.
  • Ran the mobile tasks-feature test suite (vitest run src/features/tasks/,
    196 passing), tsc --noEmit, and biome check on the touched files.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Thread the selected sandbox environment / custom base image through the mobile
cloud-task warm path so a warmed sandbox matches what the task will actually run
on.

- `warmTask()` now optionally includes `sandbox_environment_id` / `custom_image_id`
  in the request body (only when set).
- `useWarmTask` folds both ids into the debounce/dedupe key, so changing the
  selection re-warms, and forwards them to the warm call.
- `runTaskInCloud` carries the ids on the run so a reused warm sandbox matches
  the selection instead of a mismatched default.

Generated-By: PostHog Code
Task-Id: 5c715645-baa3-460e-91ca-73ee7e7fad86
@Gilbert09
Gilbert09 requested a review from a team July 20, 2026 16:27
@trunk-io

trunk-io Bot commented Jul 20, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 85dddb7.

…-image

Generated-By: PostHog Code
Task-Id: 2684a08b-4ecb-4bfb-8d8e-39030b31c449

Copy link
Copy Markdown
Member Author

/trunk merge

🦉 via talyn.dev

@trunk-io
trunk-io Bot merged commit 2cf7ede into main Jul 21, 2026
31 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/mobile-prewarm-selected-sandbox-image branch July 21, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants